﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Popup.Master" CodeBehind="HR_PopupEmpSelect_Survey.aspx.cs" Inherits="vHCS.Web.MdlHR.Controls.HR_PopupEmpSelect_Survey" %>
<%@ Register Src="~/MdlHR/Controls/HR_ctrUserSearch.ascx" TagPrefix="uc" TagName="Seacrh" %>
<%@ Register Assembly="Core.Controls" Namespace="Core.Controls.DataReader" TagPrefix="core" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="Core.Controls" Namespace="Core.Controls.Security" TagPrefix="security" %>
<%@ Register Assembly="Core.Controls" Namespace="Core.Controls.Message" TagPrefix="cc1" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainToolbar" Runat="Server">
    <asp:Button ID="btnSave" runat="server" Text="Lưu" CssClass="btnSave" 
        Visible="false" onclick="btnSave_Click"
        OnClientClick="return validator.RequireRowSelected(this,event)"/> 
    <asp:Button ID="btnSelect" runat="server" Text="Chọn" CssClass="btnSelect" 
        Visible="true" onclick="btnSelect_Click"
        OnClientClick="return validator.RequireRowSelected(this,event)"/> 

        <cc1:messagesetting ID="mssUsedMessageList" runat="server">
            <Items>                 
                <cc1:Message Code="10029"/>                          
            </Items>
        </cc1:messagesetting>
        

</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

<div class="searchWrapper">

    <uc:Seacrh ID="ucEmpSearch" runat="server" ChooseEmpInvisible="false" />
    <div class="divButton">
        <asp:Button ID="btnSearch" runat="server" Text="Tìm kiếm" CssClass="btnFind" 
            onclick="btnSearch_Click" ValidationGroup="Search"/> 
        <asp:Button ID="btnReset" runat="server" Text="Làm mới" CssClass="btnRefresh" 
            onclick="btnReset_Click" /> 
    </div>

</div>

<div class="divClear"></div>
   
<div  class="divGrid">
    <telerik:RadGrid ID="dtgEmpList" 
            AllowMultiRowSelection="true" runat="server" 
            AutoGenerateColumns="false" Height="400"  DataSourceID="dtsLoadAllEmp"
            AllowPaging="true" PageSize="10" AllowSorting="true"
            AllowFilteringByColumn="true">
            <MasterTableView>
                <Columns>                            
                    <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" HeaderStyle-Width="40"/>
                    <telerik:GridTemplateColumn  HeaderText="STT"   ItemStyle-HorizontalAlign="Center"
                        AllowFiltering="false">
                        <ItemTemplate>
                           <%# Container.ItemIndex + 1 + dtgEmpList.PageSize * dtgEmpList.CurrentPageIndex%>
                        </ItemTemplate>      
                        <HeaderStyle Width="30px"></HeaderStyle>
                    </telerik:GridTemplateColumn> 
                      <telerik:GridBoundColumn DataField="EmployeeId" Visible="false"  HeaderText="ID" >
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="EmpCode" HeaderStyle-Width="130" HeaderText="Mã nhân viên" DataType="System.String" >
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="FullName" HeaderStyle-Width="150" HeaderText="Tên nhân viên" DataType="System.String">
                    </telerik:GridBoundColumn>                    
                    <telerik:GridTemplateColumn SortExpression="OrgChart" DataField="OrgChart" HeaderText="Cơ cấu tổ chức" DataType="System.String">
                        <ItemTemplate>
                            <asp:Label ID="lblOrgChart" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "ShortOrgChart")%>'></asp:Label>
                            <telerik:RadToolTip ID="rttOrgChart" runat="server" TargetControlID="lblOrgChart"  Text='<%#DataBinder.Eval(Container.DataItem, "OrgChart")%>'>
                            </telerik:RadToolTip>
                        </ItemTemplate>                   
                    </telerik:GridTemplateColumn>                  
                    <telerik:GridBoundColumn DataField="JobLevel" HeaderText="Cấp bậc" DataType="System.String">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="JobTitle" HeaderText="Chức vụ" DataType="System.String">
                    </telerik:GridBoundColumn>
                </Columns>
                <PagerStyle Mode="NextPrevNumericAndAdvanced"  PageButtonCount="5" HorizontalAlign="Left"  Position="Bottom" />
            </MasterTableView>
            <ClientSettings EnableRowHoverStyle="true">
                <Selecting AllowRowSelect="True" />
                <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True" FrozenColumnsCount="1">
                </Scrolling>
            </ClientSettings>
        </telerik:RadGrid>

    <core:CoreDataSource ID="dtsLoadAllEmp" runat="server" SelectMethod="GetEmpSurveyByUserSearch"
                TypeName="vHCS.HR.Business.HR_SurveySemesterCollection" 
                CacheExpirationPolicy="Sliding"
                EnableCaching="false" MaximumRowsParameterName="">      
                <SelectParameters>                   
                    <asp:ControlParameter Name="dto" ControlID="ucEmpSearch" PropertyName="ItemData" />
                    <asp:ControlParameter Name="surveyId" ControlID="hdfSurveyId" PropertyName="Value" />
                    <asp:ControlParameter Name="caller" ControlID="hdfCallerId" PropertyName="Value" />
                                       
                </SelectParameters>                 
    </core:CoreDataSource>

    
</div>

<div class="formTitle">
     <div class="formToolbar"> 
    <asp:Button ID="btnSaveBot" runat="server" Text="Lưu" CssClass="btnSave" 
        Visible="false" onclick="btnSave_Click" OnClientClick="return validator.RequireRowSelected(this,event)"/> 
    <asp:Button ID="btnSelectBot" runat="server" Text="Chọn" CssClass="btnSelect" 
        OnClientClick="return validator.RequireRowSelected(this,event)"
        Visible="true" onclick="btnSelect_Click"/> 
</div>
</div>

<asp:HiddenField ID="hdfCallerId" runat="server" />
<asp:HiddenField ID="hdfSurveyId" runat="server" />
<script type="text/javascript">
    var validator = new PopEmpSelectingValidator();

    function PopEmpSelectingValidator() {
        this.RequireRowSelected = function (sender, event) {
            var messenger = new Message();
            //Chưa chọn nhóm dữ liệu
            if (new Grid().CheckRowSelected("<%= dtgEmpList.MasterTableView.ClientID %>") == false) {
                messenger.ShowObject(alertmsg_10029);
                return false;
            }
            return true;
        }

    }
    function SaveCallback(args) {
        var win = new WindowManager().GetRadWindow();
        win.BrowserWindow.ReturnEmployee(args);
        win.close();
    }
</script>
</asp:Content>

